//继承
//父类
var Animal={
    createNew:function(){
        var animal={};
        animal.sleep=function(){
            console.log('sleep');
        }
        return animal;
    }
}
//动物的子类，猫
var Cat={
    createNew:function(name){
        var cat=Animal.createNew();
        cat.name=name;
        var sound ='mmm';//私有属性
        cat.makeSound=function(){
            console.log(sound);
        }
        return cat
    }
}

var tom=Cat.createNew('大猫');
console.log(tom.name);
tom.sleep();
tom.makeSound();